package o;

import android.content.Context;
import com.huawei.appgallery.agreement.api.ui.ISignInfoActivityProtocol;
import com.huawei.hms.framework.common.ContainerUtils;
import o.ckl.d;
import o.der.f;

public class egj implements d {
    private int ˊ;
    private boolean ˋ;
    private int ˎ;
    private Context ˏ;
    private int ॱ;
    private long ᐝ;

    public static class a {
        private int ˊ;
        private int ˋ;
        private boolean ˎ;
        private int ˏ;
        private Context ॱ;

        public a(Context context, int i, boolean z) {
            this.ॱ = context;
            this.ˋ = i;
            this.ˎ = z;
        }

        public a ˎ(int i) {
            this.ˏ = i;
            return this;
        }

        public a ˊ(int i) {
            this.ˊ = i;
            return this;
        }

        public egj ˋ() {
            return new egj();
        }
    }

    private egj(a aVar) {
        this.ᐝ = 0;
        this.ˏ = aVar.ॱ;
        this.ˎ = aVar.ˋ;
        this.ˋ = aVar.ˎ;
        this.ˊ = aVar.ˏ;
        this.ॱ = aVar.ˊ;
    }

    private boolean ˋ() {
        boolean z = true;
        long currentTimeMillis = System.currentTimeMillis();
        if (currentTimeMillis - this.ᐝ >= 1000) {
            z = false;
        }
        this.ᐝ = currentTimeMillis;
        return z;
    }

    public void ˊ() {
        if (!ˋ()) {
            String ॱ;
            fjb ॱ2;
            if (this.ˎ == 1) {
                ॱ = eqp.ॱ();
                if (eqp.ᐝ() || axe.ˏ(ॱ)) {
                    axb.ˎ(this.ˏ, ॱ(ॱ));
                    return;
                }
                ॱ2 = dir.ॱ();
                ((ISignInfoActivityProtocol) ॱ2.ˊ()).setPrivacyOversea(false);
                fiu.ˊ().ˏ(this.ˏ, ॱ2);
            } else if (this.ˎ == 2) {
                ॱ = eqp.ॱ();
                if (eqp.ᐝ() || axe.ˏ(ॱ)) {
                    axb.ˎ(this.ˏ, ˋ(ॱ));
                    return;
                }
                ॱ2 = dir.ॱ();
                ((ISignInfoActivityProtocol) ॱ2.ˊ()).setPrivacyOversea(true);
                fiu.ˊ().ˏ(this.ˏ, ॱ2);
            } else if (this.ˎ == 3) {
                if (doo.ˊ(this.ˏ)) {
                    ((azj) fho.ˏ().ˋ("AGWebView").ॱ(azj.class)).ˋ(this.ˏ, "user_privacy_webview", "file:///android_asset/about/OpenSourceSoftwareNotice.html", false);
                } else {
                    evk.ˏ(this.ˏ, f.ʻʽ, 0).ˋ();
                }
            } else if (this.ˎ == 4) {
                axb.ˎ(this.ˏ, ˋ(eqp.ॱ()));
            }
        }
    }

    private String ॱ(String str) {
        StringBuilder append = new StringBuilder().append(o.dvd.a.ˊ).append(str).append(ContainerUtils.FIELD_DELIMITER).append("branchid").append(ContainerUtils.KEY_VALUE_DELIMITER).append(this.ॱ).append(ContainerUtils.FIELD_DELIMITER).append("language").append(ContainerUtils.KEY_VALUE_DELIMITER).append(doi.ॱ());
        if ("com.huawei.appmarket".equals(fis.ˎ().getPackageName())) {
            long ॱ = eua.ˏ().ॱ("protocol_lastest_version_code", -1);
            if (ॱ >= 0) {
                append.append(ContainerUtils.FIELD_DELIMITER).append("version").append(ContainerUtils.KEY_VALUE_DELIMITER).append(ॱ);
            } else {
                Logger.ˎ("PolicyClickImp", "invalid agreementVersion: " + ॱ);
            }
        }
        return append.toString();
    }

    private String ˋ(String str) {
        StringBuilder append = new StringBuilder().append(cvx.ˎ("app.privacy.domain")).append(str).append(ContainerUtils.FIELD_DELIMITER).append("branchid").append(ContainerUtils.KEY_VALUE_DELIMITER).append(this.ˊ).append(ContainerUtils.FIELD_DELIMITER).append("language").append(ContainerUtils.KEY_VALUE_DELIMITER).append(doi.ॱ());
        if ("com.huawei.appmarket".equals(fis.ˎ().getPackageName())) {
            long ॱ = eua.ˏ().ॱ("privacy_lastest_version_code", -1);
            if (ॱ >= 0) {
                append.append(ContainerUtils.FIELD_DELIMITER).append("version").append(ContainerUtils.KEY_VALUE_DELIMITER).append(ॱ);
            } else {
                Logger.ˎ("PolicyClickImp", "invalid privacyVersion: " + ॱ);
            }
        }
        return append.toString();
    }
}
